package objects 
{
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import helpers.InputController;
	
	/**
	 * ...
	 * @author Ja
	 */
	public class BtnPrev extends Sprite 
	{
		[Embed(source="../../assets/btnPrev_UP.png")]
		private var UPClass:Class;
		private var upBitmap:Bitmap = new UPClass();
		
		[Embed(source="../../assets/btnPrev_OVER.png")]
		private var OVERClass:Class;
		private var overBitmap:Bitmap = new OVERClass();
		
		private var _inputControll:InputController;
		
		public function BtnPrev() 
		{
			showUP();
			addChild(upBitmap);
			addChild(overBitmap);
			this.buttonMode = true;
			this.name = "BtnPrev";
			setUpInput();
		}
		
		private function setUpInput():void 
		{
			_inputControll = InputController.getInstance("mouseOver", MouseEvent);
			_inputControll.addSignal(this, showOVER, "mouseOver", MouseEvent);
			_inputControll.addSignal(this, showUP, "mouseOut", MouseEvent);
		}
		private function showUP(e:MouseEvent=null):void 
		{
			upBitmap.visible = true;
			overBitmap.visible = false;
		}
		private function showOVER(e:MouseEvent=null):void 
		{
			upBitmap.visible = false;
			overBitmap.visible = true;
		}
		
		public function dispose():void
		{
			_inputControll.unregisterAllFrom(this, true);
			removeChild(upBitmap);
			upBitmap = null;
			removeChild(overBitmap);
			overBitmap = null;
			UPClass = null;
			OVERClass = null;
			parent.removeChild(this);
		}
		
	}

}